package com.redStudio.queryTest.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.redStudio.queryTest.modal.MondataDaily;

public interface MondataDailyRepository extends JpaRepository<MondataDaily, Integer> {
	
	/*private int area_id;
	private String area_name;
	private int mon_point_id;
	private String mon_point_name;
	private int dev_id;
	private String dev_mn;
	private int data_type_id;
	private String data_type_name;
	private double rtd_sum;
	private int rtd_nums;
	private double rtd_avg;	*/
	String sSqlBase = "select i from view_mondatahour i ";
	
	String sSqlHasAllParam = "where "
			+ "area_name like ?1 and "
			+ "mon_point_id like ?2 and"
			+ "dev_mn like ?3 and"
			+ " data_type_name like ?4";
			                                       
	 
	//	+ "rtd_avg >=？5 and rtd_avg<=?6 and"
	//	+ "time >?7 and time <=?8"
	
	@Query(sSqlBase)
	List<MondataDaily> findAllList();
	
	@Query(sSqlBase + sSqlHasAllParam)
	List<MondataDaily> findListByParam(String area_name,
																		String mon_point_name,
																		String dev_mn,
																		String data_type_name);
	
	

}
